#define _CRT_SECURE_NO_WARNINGS
#include <iostream>

using namespace std;

bool backspaceCompare(string s, string t) {
    string ret1, ret2;
    for (auto ch : s)
    {
        if (ret1.size() && ch == '#')
            ret1.pop_back();
        else if (ch != '#')
            ret1.push_back(ch);
    }

    for (auto ch : t)
    {
        if (ret2.size() && ch == '#')
            ret2.pop_back();
        else if (ch != '#')
            ret2.push_back(ch);
    }

    cout << ret1 << endl;
    cout << ret2 << endl;

    if (ret1 == ret2)
        return true;
    return false;
}

int main()
{

	return 0;
}